import { Badge, Input, InputNumber, message, Popconfirm, Space, TableColumnsType, Tag, Tooltip, Typography } from 'antd'
import type { BoxLabelVO, ITableData } from './types'
import { NavigateFunction } from 'react-router-dom'
import React from 'react'
import { BOXMARK_STATUS_TEXT, BOXMARK_TYPE_TEXT } from '@/constant/purchase'
import { BadgeColorMapSpec } from '@/constant'
import { CheckOutlined, CloseOutlined, EditOutlined, QuestionCircleOutlined } from '@ant-design/icons'
export const useBoxMarkColumns = ({
  tableData,
  settableData,
  navigate,
  onSave,
  reloadPgae,
}: {
  navigate: NavigateFunction
  tableData: ITableData[]
  settableData: React.Dispatch<React.SetStateAction<ITableData[]>>
  onSave: (tableData: ITableData) => void
  reloadPgae: () => void
}): TableColumnsType<BoxLabelVO> => [
  {
    title: '数据层级',
    dataIndex: 'boxLabelCode',
    key: 'boxLabelCode',
    align: 'center',
    fixed: 'left',
    width: 200,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '采购订单号',
    dataIndex: 'preloadQty',
    key: 'preloadQty',
    align: 'center',
    width: 160,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '大类',
    dataIndex: 'scannedQty',
    key: 'scannedQty',
    align: 'center',
    width: 160,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '供应商',
    dataIndex: 'boxLabelTypeName',
    key: 'boxLabelTypeName',
    align: 'center',
    width: 180,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '正式订单时间',
    dataIndex: 'loadCode',
    key: 'loadCode',
    align: 'center',
    width: 160,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '要求到货日期',
    dataIndex: 'boxLabelStatus',
    key: 'boxLabelStatus',
    align: 'center',
    width: 130,
    render: (info) => {
      return info ? <Badge color={BadgeColorMapSpec[info]} text={BOXMARK_STATUS_TEXT[info] || '-'} /> : '-'
    },
  },
  {
    title: '供应链交期',
    dataIndex: 'purchaseOrderCode',
    key: 'purchaseOrderCode',
    align: 'center',
    width: 200,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '最早到货时间',
    dataIndex: 'reserveInvoiceCode',
    key: 'reserveInvoiceCode',
    align: 'center',
    width: 220,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '助记码',
    dataIndex: 'productSimpleVO',
    key: 'designCode',
    align: 'center',
    width: 140,
    render: (info) => {
      return info?.designCode || '-'
    },
  },
  {
    title: '工厂款号',
    dataIndex: 'productSimpleVO',
    key: 'factorySpuCode',
    align: 'center',
    width: 140,
    render: (info) => {
      return info?.factorySpuCode || '-'
    },
  },
  {
    title: '款式编码/条码',
    dataIndex: 'productSimpleVO',
    key: 'spuName',
    align: 'center',
    width: 250,
    render: (info) => {
      return info?.spuName || '-'
    },
  },
  {
    title: '生产时间跟踪',
    dataIndex: 'productSimpleVO',
    key: 'skuCode',
    align: 'center',
    width: 150,
    render: (info) => {
      return info?.skuCode || '-'
    },
  },
  {
    title: '商品名称',
    dataIndex: 'productSimpleVO',
    key: 'colorDetailName',
    align: 'center',
    width: 150,
    render: (info) => {
      return info?.colorDetailName || '-'
    },
  },
  {
    title: '采购方式',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    render: (info) => {
      return info == 0 ? '集采' : info == 1 ? '现采' : '-'
    },
  },
  {
    title: '订单类型',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    render: (info) => {
      return info == 0 ? '首单' : info == 1 ? '返单' : '-'
    },
  },
  {
    title: '颜色（SKC）',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    render: (info) => {
      return info?.size || '-'
    },
  },
  {
    title: '尺码（SKU）',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    render: (info) => {
      return info?.size || '-'
    },
  },
  {
    title: '下单数量',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    render: (info) => {
      return info?.size || '-'
    },
  },
  {
    title: '累计成品数',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    render: (info) => {
      return info?.size || '-'
    },
  },
  {
    title: '已预约发货数量',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 140,
    render: (info) => {
      return info?.size || '-'
    },
  },
  {
    title: '在途数量',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    render: (info) => {
      return info?.size || '-'
    },
  },
  {
    title: '到货数量',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    render: (info) => {
      return info?.size || '-'
    },
  },
  {
    title: '到货率',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    render: (info) => {
      return info?.size || '-'
    },
  },
]
